{%include file="m.index.header.tpl.php"%}
<!--主体部分-->
<div class="container" style="margin-top:70px;"><br>
<!--    <div class="row" style="margin-right:10%;">
        <div  class="col-xs-sm  text-right" > <a class="btn btn-primary" href="scale2.html" style="width:30%">登记</a></div>
    </div>

-->    <div class="row" style="margin-top:10px;">
        <form action="" method="get">
            <div class="col-sm-12 distance" >
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">学年学期:</label>
                    <div class="col-sm-10">
                        <select class="form-control" name="semester_id" id="semester_id" style="padding:0;">
                            <option value="">请选择</option>
                            {%foreach from=$semester_lists key=key item=value%}
                            <option value="{%$value.semester_id%}"{%if $value.semester_id==$semester_id%}selected{%/if%}>
                                {%$value.semester_name%}</option>
                            {%/foreach%}>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-12 distance" >
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">周次:</label>
                    <div class="col-sm-10">
                        <select class="form-control" name="sanitation_week_num" id="week_id" style="padding:0;">
                            <option value="">请选择</option>
                            {%foreach from=$week_lists key=key item=value%}
                            <option value="{%$value.week_number%}"{%if $value.week_number == $sanitation_week_num%}selected{%/if%}>{%$value.week_number%}</option>
                            {%/foreach%}
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12  distance hierarchy2">
                <div class="form-group text-center" style="padding-top:0px;">
                    <input type="hidden" name="a" value="sanitation.list">
                    <button type="submit" class="btn btn-success" style="width:80%">搜索</button>
                </div>
            </div>
        </form>
    </div>
    <div class="row" style="margin-top:15px;margin-left:1px; margin-right:1px;">
        <h5  class="navbar-text text-center" style="color:red">{%$semester_data.semester_name%}第{%$sanitation_week_num%}周各班卫生情况检查登记表</h5>
        <!--<caption>
        2014-2015学年第一学期第一周
        </caption>-->

        {%foreach from=$class_lists key=key item=value%}
        <table class="table table-striped table-bordered text-center"  id="middles">
            <tr>
                <th colspan="2" class="text-center">班级:{%$value.class_name%}</th>
            </tr>
            <tr>
                <td>星期一</td>
                <td><table class="table table-striped table-bordered text-center">
                        <tr>
                            <td>常规</td>
                            <td>{%$value.infos[0].sanitation_rule%}</td>
                        </tr>
                        <tr>
                            <td>其他</td>
                            <td>{%$value.infos[0].sanitation_rests%}</td>
                        </tr>
                    </table></td>
            </tr>
            <tr>
                <td>星期二</td>
                <td><table class="table table-striped table-bordered text-center">
                        <tr>
                            <td>常规</td>
                            <td>{%$value.infos[1].sanitation_rule%}</td>
                        </tr>
                        <tr>
                            <td>其他</td>
                            <td>{%$value.infos[1].sanitation_rests%}</td>
                        </tr>
                    </table></td>
            </tr>
            <tr>
                <td>星期三</td>
                <td><table class="table table-striped table-bordered text-center">
                        <tr>
                            <td>常规</td>
                            <td>{%$value.infos[2].sanitation_rule%}</td>
                        </tr>
                        <tr>
                            <td>其他</td>
                            <td>{%$value.infos[2].sanitation_rests%}</td>
                        </tr>
                    </table></td>
            </tr>
            <tr>
                <td>星期四</td>
                <td><table class="table table-striped table-bordered text-center">
                        <tr>
                            <td>常规</td>
                            <td>{%$value.infos[3].sanitation_rule%}</td>
                        </tr>
                        <tr>
                            <td>其他</td>
                            <td>{%$value.infos[3].sanitation_rests%}</td>
                        </tr>
                    </table></td>
            </tr>
            <tr>
                <td>星期五</td>
                <td><table class="table table-striped table-bordered text-center">
                        <tr>
                            <td>常规</td>
                            <td>{%$value.infos[4].sanitation_rule%}</td>
                        </tr>
                        <tr>
                            <td>其他</td>
                            <td>{%$value.infos[4].sanitation_rests%}</td>
                        </tr>
                    </table></td>
            </tr>
            <tr>
                <td>合计</td>
                <td><table class="table table-striped table-bordered text-center">
                        <tr>
                            <td>常规</td>
                            <td>{%$value.infos[5].sanitation_rule%}</td>
                        </tr>
                        <tr>
                            <td>其他</td>
                            <td>{%$value.infos[5].sanitation_rests%}</td>
                        </tr>
                    </table></td>
            </tr>
        </table>
        {%/foreach%}
    </div>
</div>
<!--container  end-->
<!--主体部分  end-->
<!--底部-->
{%include file="m.index.footer.tpl.php"%}
<!--container  end-->
<!--      二级联动     -->
<script type="text/javascript">
    $(document).ready(function () {
        $("#semester_id").change(function () {
            if ($(this).val() == "-1") {
                $("#industr").remove(); return;
            }
            else {
                var timestamp = new Date().getTime();
                $.ajax({
                    url:"index.php?a=semester.weekjson",
                    type:"get",
                    data: "semester_id=" + $("#semester_id").find("option:selected").val() + "&timestamp=" + timestamp,
                    dataType:"json",
                    success:function(msg){

                        //实例2个字符串变量来拼接下拉列表
                        var industr = "";
                        //使用jquery解析json中的数据
                        $.each(msg, function (n, value) {
                            industr += ("<option value=\"" + value.week_number + "\">" + value.week_number);
                            industr += ("</option>");
                        });

                        $("#week_id").html(industr);
                    }
                });

            }

        });

    });
</script>